package com.weixin.paleituo.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.weixin.paleituo.R;
import com.weixin.paleituo.util.UIUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Author yichao
 * Time  2017/12/1 0:38
 * Dest  托管楼盘列表
 */

public class CollocationListRecyclerViewAdapter extends RecyclerView.Adapter<CollocationListRecyclerViewAdapter.ViewHolder> {


    private Context mContext;

    public CollocationListRecyclerViewAdapter(Context context) {
        mContext = context;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = UIUtils.inflate(mContext, R.layout.layout_item_collcation_house_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {

        if (mOnItemClickListener != null) {
            holder.mLlRootLayoutItemFloorHome.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mOnItemClickListener.onClick(v, position);
                }
            });


        }
    }

    @Override
    public int getItemCount() {
        return 2;
    }

    static

    public class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.ll_root_layout_item_collcation_house)
        LinearLayout mLlRootLayoutItemFloorHome;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);

        }
    }

    private OnItemClickListener mOnItemClickListener;

    public interface OnItemClickListener {
        public void onClick(View v, int position);

    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.mOnItemClickListener = onItemClickListener;

    }


}
